package com.example.yuwei.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.widget.Toast;

public class MyService  extends Service {
    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
    @Override
    public int  onStartCommand(Intent intent, int flags, int startId){
        Toast.makeText(this,getResources().getString(R.string.start),Toast.LENGTH_SHORT).show();
        return START_STICKY;
    }
    public void onDestory(){
        super.onDestroy();
        Toast.makeText(this,"服务已停止",Toast.LENGTH_SHORT).show();
    }
}
